package com.itheima.service;

import com.itheima.config.FeignConfiguration;
import com.itheima.pojo.User;
import com.itheima.service.impl.UserServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author weizhongli
 * @Date 2020/4/27
 * @Version v1.0
 * @Description
 *
 * 客户端接口：将请求调用封装到当前的接口中
 * @FeignClient():声明当前接口为feign客户端接口
 * value属性：设置访问服务的名称
 * fallback属性:设置服务降级的处理方法
 * configuration属性：设置Feign配置类
 **/
@FeignClient(value = "provider-service"
        ,fallback = UserServiceImpl.class
        ,configuration = FeignConfiguration.class)
public interface UserService {

    /*
    * http://localhost:9091/user/findUserById/
    * */
    @RequestMapping("/user/findUserById/{id}")
    User findUserById(@PathVariable("id") Integer id);
}
